{% extends "base.html" %}

{% block title %}管理面板 - 墨韵图书共享平台{% endblock %}

{% block content %}
<div class="admin-panel">
    <div class="row mb-4">
        <div class="col-md-12">
            <h2 class="ink-decoration mb-4">{% block admin_title %}管理面板{% endblock %}</h2>
        </div>
    </div>
    
    <div class="row">
        <div class="col-md-3">
            <div class="card ink-card mb-4">
                <div class="card-header admin-title-white">
                    <h5 class="mb-0">管理菜单</h5>
                </div>
                <div class="list-group list-group-flush">
                    <a href="{{ url_for('admin_panel') }}" class="list-group-item list-group-item-action {% if request.endpoint == 'admin_panel' %}active{% endif %}">
                        <i class="fas fa-tachometer-alt me-2"></i> 仪表盘
                    </a>
                    <a href="{{ url_for('admin_books') }}" class="list-group-item list-group-item-action {% if request.endpoint == 'admin_books' %}active{% endif %}">
                        <i class="fas fa-book me-2"></i> 图书管理
                    </a>
                    <a href="{{ url_for('admin_posts') }}" class="list-group-item list-group-item-action {% if request.endpoint == 'admin_posts' %}active{% endif %}">
                        <i class="fas fa-comments me-2"></i> 帖子管理
                    </a>
                    <a href="{{ url_for('admin_users') }}" class="list-group-item list-group-item-action {% if request.endpoint == 'admin_users' %}active{% endif %}">
                        <i class="fas fa-users me-2"></i> 用户管理
                    </a>
                    <a href="{{ url_for('admin_categories') }}" class="list-group-item list-group-item-action {% if request.endpoint == 'admin_categories' %}active{% endif %}">
                        <i class="fas fa-tags me-2"></i> 分类管理
                    </a>
                    <a href="{{ url_for('admin_statistics') }}" class="list-group-item list-group-item-action {% if request.endpoint == 'admin_statistics' %}active{% endif %}">
                        <i class="fas fa-chart-bar me-2"></i> 使用统计
                    </a>
                    <div class="dropdown-divider"></div>
                    <a href="{{ url_for('admin_export_data', type='users') }}" class="list-group-item list-group-item-action">
                        <i class="fas fa-file-export me-2"></i> 导出用户数据
                    </a>
                    <a href="{{ url_for('admin_export_data', type='books') }}" class="list-group-item list-group-item-action">
                        <i class="fas fa-file-export me-2"></i> 导出图书数据
                    </a>
                </div>
            </div>
        </div>
        
        <div class="col-md-9">
            {% block admin_content %}{% endblock %}
        </div>
    </div>
</div>
{% endblock %}

{% block scripts %}
<!-- 管理面板通用脚本 -->
<script>
    // 确保模态框正常工作
    document.addEventListener('DOMContentLoaded', function() {
        // 初始化所有模态框
        const modals = document.querySelectorAll('.modal');
        modals.forEach(modal => {
            new bootstrap.Modal(modal);
        });
    });
</script>
{% block admin_scripts %}{% endblock %}
{% endblock %} 